package org.TCC_NOVO.client.visual;

import com.gwtext.client.core.Function;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.ProgressBar;
import com.gwtext.client.widgets.WaitConfig;
import com.gwtext.client.widgets.Window;


public class WaitingBar extends Window{

    ProgressBar pbar3 = new ProgressBar();

    public WaitingBar(String titulo) {
        this.init();
        this.setTitle(titulo+" em Progresso... Aguarde");
        this.setModal(true);
    }

    private void init(){
        Panel panel3 = new Panel();
        //panel3.setTitle("Aguarde");
        panel3.setFrame(true);
        panel3.setWidth(400);
        panel3.setHeight(100);
        panel3.setPaddings(10);

        panel3.add(pbar3);        
        this.add(panel3);
    }

    public void Executar(){
        pbar3.setWidth(300);
        pbar3.reset();
        pbar3.wait(new WaitConfig() {
            {
               setInterval(100);
               setDuration(8000);
               setIncrement(5);
               setCallback(new Function() {
               @Override
               public void execute() {
                  //button.enable();
                   hide();
                  }
               });
            }
        });
    }

}
